package com.gammapeit.customjaas.constantes;

/*
 * ConstantesLdap.java
 *
 * Created on 9 de octubre de 2008, 08:53 PM
 *
 * To change this template, choose Tools | Options and locate the template under
 * the Source Creation and Management node. Right-click the template and choose
 * Open. You can then make changes to the template in the Source Editor.
 */



import java.util.ResourceBundle;

/**
 *
 * @author J L P e r e A
 */
public class ConstantesLdap {
    
    protected static ConstantesLdap instance;
    
    public static String LDAP_DIR;
    public static String LDAP_USER;
    public static String LDAP_PASSWORD;
    public static String LDAP_PEOPLE_SID;
    public static String LDAP_GROUP_SID;
    public static String LDAP_ROOT;
   
    public static String LDAP_PERSON_OBJECTCLASS_NAME;
    
    public static String LDAP_ROL_ADMINISTRADOR_CN;
    public static String LDAP_ROL_GERENCIA_CN;
    public static String LDAP_ROL_COORDINADOR_CN;
    public static String LDAP_ROL_COORDINADOR_JUNIOR_CN;
    public static String LDAP_ROL_ASESOR_CN;
    public static String LDAP_ROL_ANALISTA_CN;
    public static String LDAP_ROL_INVITADO_CN;
    public static String LDAP_ROL_CLIENTE_CN;
    
    // Ldap Autenticacion
    public static String LDAP_INITIAL_CONTEXT_FACTORY;
    public static String LDAP_SECURITY_AUNTHENTICATION;
    public static String LDAP_SECURITY_PRINCIPAL_PREFIX;
    public static String LDAP_URL_SERVER_NAME;
    public static String LDAP_DOMAIN;
    
    /** Creates a new instance of ConstantesLdap */
     protected ConstantesLdap() 
     {        
        ResourceBundle ldapSetup = ResourceBundle.getBundle(this.getClass().getPackage().getName() + ".LdapSetup");
        
        LDAP_DIR        = ldapSetup.getString("ldap_dir");        
        LDAP_USER       = ldapSetup.getString("ldap_admin_user_cn");
        LDAP_PASSWORD   = ldapSetup.getString("ldap_password");
        LDAP_PEOPLE_SID = ldapSetup.getString("ldap_people_sid");
        LDAP_GROUP_SID  = ldapSetup.getString("ldap_group_sid");
        LDAP_ROOT       = ldapSetup.getString("ldap_root");
                
        LDAP_PERSON_OBJECTCLASS_NAME = ldapSetup.getString("ldap_person_objectclass_name");
        
        LDAP_ROL_ADMINISTRADOR_CN   = ldapSetup.getString("ldap_rol_administrador_cn");
        LDAP_ROL_GERENCIA_CN        = ldapSetup.getString("ldap_rol_gerencia_cn");
        LDAP_ROL_COORDINADOR_CN     = ldapSetup.getString("ldap_rol_coordinador_cn"); 
        LDAP_ROL_COORDINADOR_JUNIOR_CN = ldapSetup.getString("ldap_rol_coordinador_junior_cn"); 
        LDAP_ROL_ASESOR_CN          = ldapSetup.getString("ldap_rol_asesor_cn");   
        LDAP_ROL_ANALISTA_CN        = ldapSetup.getString("ldap_rol_analista_cn");  
        LDAP_ROL_INVITADO_CN        = ldapSetup.getString("ldap_rol_invitado_cn");  
        LDAP_ROL_CLIENTE_CN         = ldapSetup.getString("ldap_rol_cliente_cn");  
        
        //Ldap Autentication
        this.LDAP_INITIAL_CONTEXT_FACTORY   = ldapSetup.getString("LdapInitialContextFactory");
        this.LDAP_SECURITY_AUNTHENTICATION  = ldapSetup.getString("LdapSecurityAuthentication");
        this.LDAP_SECURITY_PRINCIPAL_PREFIX = ldapSetup.getString("LdapSecurityPrincipalPrefix");
        this.LDAP_URL_SERVER_NAME           = "ldap://" + ldapSetup.getString("ldap_dir");        
    }
    
    public static ConstantesLdap getInstance() {
        if (instance == null) {
            instance = new ConstantesLdap();
        }
        return instance;
    }
    
//    public static void main(String[] a)
//    {
//        try
//        {
//            ConstantesLdap.getInstance();
//            
////            dao.isloginCorrect("Administrador", "Gammapeit14");
//        }
//        catch(Exception e)
//        {
//            e.printStackTrace();
//        }
//    }
    
}
